package com.larosa.practice.strategy;

import java.math.BigDecimal;

/**
 * @Author: larosa
 * @Description: 满 100 减 10 策略
 * @DateTime: 2025/2/9 10:21
 **/
public class FullReductionStrategy implements PricingStrategy {

    private static final BigDecimal DISCOUNT_THRESHOLD = new BigDecimal("100");
    private static final BigDecimal DISCOUNT_AMOUNT = new BigDecimal("10");
    @Override
    public BigDecimal calculateTotalPrice(int appleQuantity, int strawberryQuantity, int mangoQuantity) {
        BigDecimal total = new StrawberryDiscountStrategy().calculateTotalPrice(appleQuantity, strawberryQuantity, mangoQuantity);
        return total.compareTo(DISCOUNT_THRESHOLD) >= 0 ? total.subtract(DISCOUNT_AMOUNT) : total;
    }
}
